#!/bin/sh
# Toggle the state of identify LED Group

SERVICE="xyz.openbmc_project.Inventory.Manager"
INTERFACE="xyz.openbmc_project.Inventory.Item"
PROPERTY="PrettyName"

# Get current state
object=$(busctl tree $SERVICE --list | grep motherboard$)
if [ "$object" == "" ]
then
    ipmitool fru write 0 /usr/bin/fru-ok.bin
else
    name=$(busctl get-property $SERVICE $object $INTERFACE $PROPERTY |  awk '{print $NF;}')
    if [ "x$name" == 'x""' ]
    then
        busctl set-property $SERVICE $object $INTERFACE $PROPERTY s "G1DLH-B"
        ipmitool fru edit 0 field b 1 "G1DLH-B"
    fi
fi
